//
//  JiaoYiShenSuViewController.m
//  DBAChain
//
//  Created by Evan on 2018/9/25.
//  Copyright © 2018 Evan. All rights reserved.
//

#import "JiaoYiShenSuViewController.h"
#import "taskOverviewService.h"
#import "assetsOrderViewController.h"

@interface JiaoYiShenSuViewController ()
@property (weak, nonatomic) IBOutlet UIView *bgView;

@end

@implementation JiaoYiShenSuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"申诉";

    self.bgView.layer.cornerRadius = 10;
    self.bgView.layer.shadowColor = [UIColor grayColor].CGColor;
    self.bgView.layer.shadowOpacity = 0.8f;
    self.bgView.layer.shadowOffset = CGSizeMake(0, 0);
    self.bgView.layer.shadowRadius = 4.0f;
    
    self.btnSubmit.layer.cornerRadius = 22;
    self.btnSubmit.layer.shadowColor = COLOR_Background.CGColor;
    self.btnSubmit.layer.shadowOffset = CGSizeMake(10, 10);
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setBlackStatus:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)btnSubmitClick:(id)sender {
    NSLog(@"提交申诉文本申请");
    
    if (![Check checkNullLenght:self.txtContent.text]) {
        [DKProgressHUD showErrorWithStatus:@"请正确输入申诉文本信息"];
        return;
    }
    [DKProgressHUD showLoading];
    NSMutableDictionary *dict = [NSMutableDictionary new];
    [dict setField:@(self.orderNo) value:@"orderId"];
    [dict setField:self.txtContent.text value:@"content"];
    [taskOverviewService getOrderRevoke:dict success:^(BaseModel *response, BOOL success) {
        [DKProgressHUD dismiss];
        if (success) {
            [DKProgressHUD showSuccessWithStatus:@"申述成功"];
            for (int i = 0; i < [self.navigationController.viewControllers count]; i ++) {
                if([self.navigationController.viewControllers[i] isKindOfClass:[assetsOrderViewController class]]){
                     [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
                    break;
                }
            }
            return ;
        }
        [DKProgressHUD showErrorWithStatus:response.message];
    } failture:^(NSError *error, NSString *strDescription) {
        [DKProgressHUD dismiss];
        [DKProgressHUD showErrorWithStatus:strDescription];
    }];
}



@end
